

var WINDOW_RESIZE = [];

function onWindowResizeEvent(callback) {
    var map = {};
    WINDOW_RESIZE.forEach(function (fn) {
        map[fn.name] = true;
    });
    if (map[callback.name])
        return;
    WINDOW_RESIZE.push(callback);
}

$(document).ready(function() {
    $(window).resize(function (e) {
        if (WINDOW_RESIZE.length == 0) {
            return;
        }

        WINDOW_RESIZE.forEach(function (fn) {
            fn();
        });

    });
});

function loadPlugin() {
    for (var i in arguments) {
        arguments[i]();
    }
}

// 左侧菜单滚动条组件
function pluginSidebarNavSlimscroll() {
    onWindowResizeEvent(pluginSidebarNavSlimscroll);
    var container = $('aside.main-sidebar');
    var element = $('aside.main-sidebar div.sidebar-nav-content');
    element.slimScroll({
        height: (container.height() + 50) + 'px'
    });
    container.css('overflow', 'hidden');
}

